.PHONY: clean

FLAGS = -std=c++0x -g -Wall -pedantic

clean:
	@echo [Cleaning source directory]
	@rm -f *.o
	@rm -f *.gch
	@rm -f *~
	@rm -f a.out
	@rm -f test
	@rm -f gmon.out
	@rm -f core


test: main.cpp linalg.o geometry3d.o geometry2d.o
	g++ $(FLAGS) main.cpp linalg.o geometry3d.o geometry2d.o -o test -llapack

fit-plane: fit_points.cpp geometry3d.o io.o linalg.o
	g++ $(FLAGS) fit_points.cpp geometry3d.o io.o linalg.o -o fit-plane -llapack

linalg.o: linalg.hpp linalg.cpp Makefile slice.hpp
	g++ $(FLAGS) -c linalg.cpp -o linalg.o

geometry3d.o: geometry3d.cpp geometry3d.hpp Makefile slice.hpp
	g++ $(FLAGS) -c geometry3d.cpp -o geometry3d.o

geometry2d.o: geometry2d.cpp geometry2d.hpp Makefile slice.hpp
	g++ $(FLAGS) -c geometry2d.cpp -o geometry2d.o

io.o : io.cpp io.hpp Makefile
	g++ $(FLAGS) -c io.cpp -o io.o